package com.woniuxy.springbootmybatis.controller;

import com.woniuxy.springbootmybatis.entity.User;
import com.woniuxy.springbootmybatis.service.IUserService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * @author linke
 * @version 1.0
 * @className: UserController
 * @description: TODO 类描述
 * @date 2021/11/16 20:18
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Resource
    private IUserService userService;

    @RequestMapping("/all")
    public List<User> all(){
        return userService.all();
    }


    @RequestMapping("/add")
    public int add(){
        int row = userService.add(new User(null,"aa",22,new Date()));
        return row;
    }

}
